package net.mikoo.seals.utils;

import java.util.Map;

public class MapUtil {
	
	@SuppressWarnings("rawtypes")
	public static Integer getInteger(String key,Map params){
		if (params == null) {
			return null;
		}
		try {
			Object value = params.get(key);
			if (value != null) {
				return Integer.parseInt(value.toString());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}

		return null;
	}
	
	@SuppressWarnings("rawtypes")
	public static Long getLong(String key,Map params){
		if (params == null) {
			return null;
		}
		try {
			Object value = params.get(key);
			if (value != null) {
				return Long.parseLong(value.toString());
			}
		} catch (Exception e) {
			e.printStackTrace();
		}
		
		return null;
	}
	
	@SuppressWarnings("rawtypes")
	public static String getString(String key,Map params){
		if (params == null) {
			return null;
		}
		
		Object value = params.get(key);
		if (value != null) {
			return value.toString();
		}
		
		return null;
	}
}
